import * as Api from '@/api/system/dict-type'

const dictType = {
  state: {
  },
  mutations: {
  },
  actions: {
    GetDictTypePage({ commit }, param) {
      return new Promise((resolve, reject) => {
        Api.getDictTypePage(param)
          .then(res => {
            resolve(res.data)
          })
          .catch(err => {
            reject(err)
          })
      })
    },
    GetDictTypeById({ commit }, id) {
      return new Promise((resolve, reject) => {
        Api.getDictTypeById(id)
          .then(res => {
            resolve(res.data)
          })
          .catch(err => {
            reject(err)
          })
      })
    },
    SaveDictType({ commit }, data) {
      return new Promise((resolve, reject) => {
        Api.saveDictType(data)
          .then(res => {
            resolve(res.data)
          })
          .catch(err => {
            reject(err)
          })
      })
    },
    UpdateDictTypeById({ commit }, { id, data }) {
      return new Promise((resolve, reject) => {
        Api.updateDictTypeById(id, data)
          .then(res => {
            resolve(res.data)
          })
          .catch(err => {
            reject(err)
          })
      })
    },
    RemoveDictTypeById({ commit }, id) {
      return new Promise((resolve, reject) => {
        Api.removeDictTypeById(id)
          .then(res => {
            resolve(res.data)
          })
          .catch(err => {
            reject(err)
          })
      })
    }
  }
}

export default dictType
